home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / XML Writer 2.12 / XML writer.exe / file0009.bin < prev    next >
Encoding:
Extensible Markup Language  |  2003-04-14  |  5.9 KB  |  186 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!--See LibraryXslt.xml for details on how to use this XSLT stylesheet for transformation-->
  4.  
  5. <!--XSL Stylesheet declaration.
  6.     'xmlns:xsl="http://www.w3.org/1999/XSL/Transform"' indicates that elements with the
  7.     namespace prefix 'xsl:' belong to the http://www.w3.org/1999/XSL/Transform namespace.
  8.     'version="1.0"' indicates the current version of the XSLT W3C specification.-->
  9. <xsl:stylesheet
  10.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  11.     version="1.0">
  12.  
  13. <!--The root template specifies the root node of the output document, in this case 'html'.-->
  14. <xsl:template match="/">
  15.  
  16. <!--Build the output document, in this case a HTML page.-->
  17. <html>
  18.     <head>
  19.         <!--Create a 'title' element using the contents of 'name'
  20.             (which is a child element of 'library').-->
  21.         <title><xsl:value-of select="/library/name"/></title>
  22.     </head>
  23.     <body>
  24.         <!--Create a 'h1' element using the contents of 'name'
  25.             (which is a child element of 'library').-->
  26.         <h1><xsl:value-of select="/library/name"/></h1>
  27.         <h2>Catalog Listing</h2>
  28.         <blockquote>
  29.             <h3>Books:</h3>
  30.             <blockquote>
  31.                 <!--Process the 'book' element (which is a child element of 'library')
  32.                     according to its template.-->
  33.                 <xsl:apply-templates select="/library/book"/>
  34.             </blockquote>
  35.             <h3>Journals:</h3>
  36.             <blockquote>
  37.                 <!--Process the 'journal' element (which is a child element of 'library')
  38.                     according to its template.-->
  39.                 <xsl:apply-templates select="/library/journal"/>
  40.             </blockquote>
  41.             <h3>Videos:</h3>
  42.             <blockquote>
  43.                 <!--Process the 'video' element (which is a child element of 'library')
  44.                     according to its template.-->
  45.                 <xsl:apply-templates select="/library/video"/>
  46.             </blockquote>
  47.         </blockquote>
  48.     </body>
  49. </html>
  50. </xsl:template>
  51.  
  52. <!--The following template information applies to 'book' elements.-->
  53. <xsl:template match="book">
  54.     <!--Create a link 'a' with an attribute ="href" which uses the
  55.         content of 'online_url' as the attribute value.-->
  56.     <em><a>
  57.         <xsl:attribute name="href">
  58.             <xsl:value-of select="online_url"/>
  59.         </xsl:attribute>
  60.         <!--Process the 'title' element according to its template.-->
  61.         <xsl:apply-templates select="title"/>
  62.     </a></em>
  63.     <br/><br/>
  64.     <!--Create a table for the 'author' and 'callno' elements.-->
  65.     <table border="1" cellpadding="10">
  66.         <tr>
  67.             <td><b>Author(s):</b></td>
  68.             <!--Process the 'author' element according to its template.-->
  69.             <td><xsl:apply-templates select="author"/></td>
  70.         </tr>
  71.         <tr bgcolor="#CCCCFF">
  72.             <td><b>Call No:</b></td>
  73.             <!--Process the 'callno' element according to its template.-->
  74.             <td><xsl:apply-templates select="callno"/></td>
  75.         </tr>
  76.     </table>
  77.     <br/>
  78. </xsl:template>
  79.  
  80. <!--The following template information applies to 'video' elements.-->
  81. <xsl:template match="video">
  82.     <em>
  83.         <!--Process the 'title' element according to its template.-->
  84.         <xsl:apply-templates select="title"/>
  85.     </em>
  86.     <br/>
  87.     <br/>
  88.     <!--Create a table for the 'director' and 'callno' elements.-->
  89.     <table border="1" cellpadding="10">
  90.         <tr>
  91.             <td><b>Director:</b></td>
  92.             <!--Process the 'director' element according to its template.-->
  93.             <td><xsl:apply-templates select="director"/></td>
  94.         </tr>
  95.         <tr bgcolor="#CCCCFF">
  96.             <td><b>Call No:</b></td>
  97.             <!--Process the 'callno' element according to its template.-->
  98.             <td><xsl:apply-templates select="callno"/></td>
  99.         </tr>
  100.     </table>
  101. </xsl:template>
  102.  
  103. <!--The following template information applies to 'journal' elements.-->
  104. <xsl:template match="journal">
  105.     <em>
  106.         <!--Process the 'title' element according to its template.-->
  107.         <xsl:apply-templates select="title"/>
  108.     </em>
  109.     <br/><br/>
  110.     <!--Process the 'date' element according to its template.-->
  111.     Date of Publication: <xsl:apply-templates select="date"/>
  112.     <br/><br/>
  113.     <!--Create a table for the 'callno' element.-->
  114.     <table border="1" cellpadding="10">
  115.         <tr bgcolor="#CCCCFF">
  116.             <td><b>Call No:</b></td>
  117.             <!--Process the 'callno' element according to its template.-->
  118.             <td align="center"><xsl:apply-templates select="callno"/></td>
  119.         </tr>
  120.     </table>
  121. </xsl:template>
  122.  
  123. <!--Template for 'title' which is a child element of 'book'.-->
  124. <xsl:template match="book/title">
  125.     <!--Apply the following style to 'title'.-->
  126.     <font color="blue">
  127.         <!--Insert the contents of the 'title' element.-->
  128.         <xsl:value-of select="."/>
  129.     </font>
  130. </xsl:template>
  131.  
  132. <!--Template for 'title' which is a child element of 'journal'.-->
  133. <xsl:template match="journal/title">
  134.     <!--Insert the contents of the 'title' element.-->
  135.     <xsl:value-of select="."/>
  136. </xsl:template>
  137.  
  138. <!--Template for 'title' which is a child element of 'video'.-->
  139. <xsl:template match="video/title">
  140.     <!--Apply the following style to 'title'.-->
  141.     <font color="green">
  142.         <!--Insert the contents of the 'title' element.-->
  143.         <xsl:value-of select="."/>
  144.     </font>
  145. </xsl:template>
  146.  
  147. <xsl:template match="first-name">
  148.     <!--Insert the contents of the 'first-name' element.-->
  149.     <xsl:value-of select="."/>
  150.     <!--Insert white space.-->
  151.     <xsl:text> </xsl:text>
  152. </xsl:template>
  153.  
  154. <xsl:template match="last-name">
  155.     <!--Apply the following style to 'last-name'.-->
  156.     <b>
  157.         <!--Insert the contents of the 'last-name' element.-->
  158.         <xsl:value-of select="."/>
  159.     </b>
  160.     <br/>
  161. </xsl:template>
  162.  
  163. <xsl:template match="callno">
  164.     <!--Apply the following style to 'callno'.-->
  165.     <font face="courier new" color="gray">
  166.         <!--Insert the contents of the 'callno' element.-->
  167.         <xsl:value-of select="."/>
  168.     </font>
  169. </xsl:template>
  170.  
  171. <xsl:template match="director">
  172.     <!--Insert the contents of the 'director' element.-->
  173.     <xsl:value-of select="."/>
  174. </xsl:template>
  175.  
  176. <xsl:template match="date">
  177.     <!--Insert the contents of the 'date' element.-->
  178.     <xsl:value-of select="."/>
  179. </xsl:template>
  180.  
  181. </xsl:stylesheet>
  182.  
  183. <!--This file was created using XMLwriter v2.0 Beta 2.
  184.     Copyright Wattle Software 2002. All rights reserved.
  185.     http://XMLwriter.net/-->
  186.